import { createRouter, createWebHistory } from 'vue-router';
import Home from '../views/Home.vue'; // 引入首页组件
import About from '../views/About.vue'; // 引入关于页面组件
import Default from '../views/home/Default.vue'
import Data from '../views/home/Data.vue'
import Others from '../views/home/Others.vue'
import VideoList from '../views/video/VideoList.vue'
import FileUpload from '../views/home/FileUpload.vue';

// 定义路由规则
const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    children: [
      {
        path: '/',
        name: 'Default',
        component: Default
      },
      {
        path: '/pdf/:index?',
        name: 'Data',
        component: Data
      },
      {
        path: '/data/others',
        name: 'Others',
        component: Others
      }
    ]
  },
  {
    path: '/upload',
    name: 'Upload',
    component: FileUpload,
  },
  {
    path: '/about',
    name: 'About',
    component: About,
  },
  {
    path: '/videos',
    name: 'Videos',
    component: VideoList,
  },
];

// 创建路由器实例
const router = createRouter({
  history: createWebHistory(), // 使用 HTML5 History 模式
  routes, // 路由规则
});

export default router;